<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://doc.hyperf.io
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
 */

use Hyperf\HttpServer\Router\Router;

        Router::addRoute(['GET', 'POST', 'HEAD'], '/', 'App\Controller\IndexController@index');

        Router::get('/setting/{id}', 'App\Controller\IndexController@getById'); //前台获取信息
        Router::post('/admin/login', 'App\Controller\Admin\UserController@login'); //管理员登录
        Router::get('/admin/login/bing', 'App\Controller\Admin\UserController@bing'); //登录背景图

        Router::addGroup('/admin/',
            function (){
                Router::get('login/getUserInfo', 'App\Controller\Admin\UserController@userInfo'); // 获取登录用户信息

                Router::get('setting/{id}', 'App\Controller\Admin\SettingController@getById'); // 获取设置信息
                Router::post('setting/save', 'App\Controller\Admin\SettingController@save'); // 保存设置
                Router::post('setting/upload', 'App\Controller\Admin\SettingController@upload'); // 上传图片
            },
            ['middleware' => [App\Middleware\AdminMiddleware::class]]
        );

